package com.siyuan.sns.utils.web;

import javax.servlet.ServletContext;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class BeanContextUtils {
	public static Object getBean(String name) {
		ServletContext servletContext = ServletActionContext
				.getServletContext();
		ApplicationContext applicationContext = WebApplicationContextUtils
				.getRequiredWebApplicationContext(servletContext);

		return applicationContext.getBean(name);
	}
}
